import axios from "axios";
axios.interceptors.request.use(
  function (config) {
    const token = localStorage.getItem("myToken");
    config.headers.Authorization = `Bearer ${token}`;
    return config;
  },
  function (error) {
    return Promise.reject(error);
  }
);

axios.interceptors.response.use(
  function (response) {
    const { authorization } = response.headers;
    authorization && localStorage.setItem("myToken", authorization);
    return response;
  },
  function (error) {
    return Promise.reject(error);
  }
);
